//
//  PrivateSearchViewController.m
//  Utils
//
//  Created by enghou on 2018/5/1.
//  Copyright © 2018年 xyxorigation. All rights reserved.
//

#import "PrivateSearchViewController.h"
#import "KeyContentCell.h"
@interface PrivateSearchViewController ()

@end

@implementation PrivateSearchViewController

-(NSDictionary *)param{
    NSMutableDictionary *param = [NSMutableDictionary dictionary];
    for (int i = 0; i < 11; i ++) {
        NSIndexPath *index = [NSIndexPath indexPathForRow:i inSection:0];
        KeyContentCell *cell = [self.tableView cellForRowAtIndexPath:index];
        if ([cell isKindOfClass:[KeyContentCell class]]) {
            [param addEntriesFromDictionary:[cell param]];
        }
    }
    if ([self.orgModel.ids length] > 0) {
        [param setObject:self.orgModel.ids forKey:@"searchNewEconomicOrganizationsVo.style"];
    }
    return param;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;
    
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)chooseOrgType{
    if (!self.orgTypes) {
        [self commonAlertWithContent:@"社会组织类型" choosenBlock:^(PropertyDictItemModel *model) {
            self.orgModel = model;
            self.orgNameLabel.text = self.orgModel.displayName;
        } getList:^(NSArray *array) {
            self.orgTypes = array;
        }];
    }else{
        [self alertWithArray:self.states choosenBock:^(PropertyDictItemModel *model) {
            self.orgModel = model;
            self.orgNameLabel.text = self.orgModel.displayName;
        }];
    }
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 2) {
        [self chooseOrgType];
    }
}

@end
